package deepbrain.simnetwork.monitor;

import java.util.ArrayList;

import deepbrain.simnetwork.network.NetworkState;
import deepbrain.simnetwork.task.SimulationTask;

public class NetworkStateLogMonitor extends MonitorAdapter<SimulationTask>
		implements SimTaskMonitor {

	protected ArrayList<NetworkState> networkStates;
	protected String resultKey = "state-log";

	public NetworkStateLogMonitor() {
	}

	public NetworkStateLogMonitor(String resultKey) {
		this.resultKey = resultKey;
	}

	@Override
	public void onTaskStart(SimulationTask task) {
		networkStates = new ArrayList<NetworkState>();
	}

	@Override
	public void onStepFinish(SimulationTask task) {
		networkStates.add(task.getNetworkState());
	}

	@Override
	public void onTaskFinish(SimulationTask task) {
		task.addTaskResult("state-log", networkStates);
	}

}
